<?php

namespace app\factory\controller;

use app\common\respond\HttpApi;
use app\factory\logic\PigWeightUpLogic;

class PigWeightUpController
{
    /**
     * @Description 新增/编辑
     * @author: zj
     * @param HttpApi $respond
     * @time 2024/03/18 15:55:05
     * @return \think\response\Json
     */
    public function addEdit(HttpApi $respond)
    {
        $param = [
            'Id' => request()->post('Id'),
            'PigId' => request()->post('PigId'),
            'FeedPreDayId' => request()->post('FeedPreDayId'),
            'WeightUp' => request()->post('WeightUp'),
            'Fmr' => request()->post('Fmr'),
            'Weight' => request()->post('Weight'),
            'RecordTime' => request()->post('RecordTime')
        ];
        $rule = [
            'Id' => 'require|integer|>:0',
            'PigId' => 'require|integer|>:0',
            'RecordTime' => 'require|integer|>:0'
        ];
        validate($rule)->check($param);

        $logic = new PigWeightUpLogic();
        $data = $logic->addEdit($param['Id'],$param['PigId'],$param);

        return $respond->success([]);
    }

}